using System;
using System.Collections.Generic;
using System.Text;
using TaugeLibrary.Enums;

namespace TaugeLibrary.Classes.Attributes
{
    [AttributeUsage(AttributeTargets.Property , AllowMultiple = false)]
    public class AttField:System.Attribute
    {
        string m_field_name;
        public string FieldName { set { m_field_name = value; } get { return m_field_name; } }
        
        eDBDataType m_data_type = eDBDataType.INT;
        public eDBDataType FieldType { set { m_data_type = value; } get { return m_data_type; } }

        int m_length = 0;
        public int Length { set { m_length = value; } get { return m_length; } }

        string m_alias = "";
        public string Alias { set { m_alias = value; } get { if (m_alias == "") return m_field_name; else return m_alias; } }


        bool m_nullable = false;
        public bool Nullable { set { m_nullable = value; } get { return m_nullable; } }

        public AttField(string p_fieldname, eDBDataType p_datatype, int p_length)
        {
            FieldName = p_fieldname; FieldType  = p_datatype; Length = p_length;
        }

        public AttField(string p_fieldname, eDBDataType p_datatype, int p_length, string p_alias)
        {
            FieldName = p_fieldname; FieldType  = p_datatype; Length = p_length; Alias = p_alias;
        }
    }
}
